<?php


class Form_User extends Zend_Form{




    public function  __construct($options = null) {

        $this->setName('form_user');
        parent::__construct($options);


        $username = new Zend_Form_Element_Text('username');
        $username->setLabel('Username');
        $username->setRequired(true);
        $username->addValidator('NotEmpty');
        $username->addValidator('Db_NoRecordExists',false,array('table'=>'users','field'=>'username'));
        $username->addValidator('Alnum');
        $username->addFilter('StringTrim');
        $username->addFilter('StripTags');
        
        $password = new Zend_Form_Element_Password('password' );
        $password->setLabel('Password');
        $password->setRequired(true);
        $password->addValidator('NotEmpty');
       // $password->addValidator('NoRecordExist','users');
        //$password->addValidator('Alnum');
        $password->addFilter('StringTrim');
        $password->addFilter('StripTags');

        $confirm = new Zend_Form_Element_Password('confirm');
        $confirm->setLabel('confirm password');
        $confirm->setRequired(true);
        $confirm->addValidator('NotEmpty');
        $confirm->addPrefixPath('Component_Validator', APPLICATION_PATH.'/component/validator','validate');
        $confirm->addValidator('Passwordconfirm');

        $email = new Zend_Form_Element_Text('email' );
        $email->setLabel('EMail');
        $email->setRequired(true);
        $email->addValidator('NotEmpty');
        $email->addValidator('EmailAddress');
        $submit = new Zend_Form_Element_Submit('submit' );


        $this->addElements(array($username,$password,$confirm,$email,$submit));



    }




}